<template>
  <div>
    <a-form :form="form" style="max-width: 500px; margin: 40px auto 0;" :label-col="labelCol" :wrapper-col="wrapperCol">
      <a-form-item label="姓名"  >
        <a-input v-decorator="['professorName']" :disabled="true"/>
      </a-form-item>

      <a-form-item label="性别">
        <j-dict-select-tag
          :disabled="true"
          type="list"
          v-decorator="['professorSex']"
          :trigger-change="true"
          dictCode="sex" />
      </a-form-item>

      <a-form-item label="出生年月">
        <j-date   v-decorator="['professorBirthday']" :trigger-change="true" :disabled="true" style="width: 100%"/>
      </a-form-item>

      <a-form-item label="身份证号">
        <a-input v-decorator="['professorIdentity']" :disabled="true"></a-input>
      </a-form-item>

      <a-form-item label="学历">
        <j-dict-select-tag type="list" :disabled="isNotChangeInfo" v-decorator="['professorEducationBackground']" :trigger-change="true" dictCode="education"/>
      </a-form-item>
      <a-form-item label="学位">
        <j-dict-select-tag type="list" :disabled="isNotChangeInfo" v-decorator="['professorDegree']" :trigger-change="true" dictCode="degree" />
      </a-form-item>

        <a-form-item label="通讯地址">
          <a-input v-decorator="['professorAddress']" :disabled="isNotChangeInfo"></a-input>
        </a-form-item>
        <a-form-item label="家庭地址">
          <a-input v-decorator="['professorHomeAddress']" :disabled="isNotChangeInfo"/>
        </a-form-item>
        <a-form-item label="健康状态">
          <j-dict-select-tag type="list" :disabled="isNotChangeInfo" v-decorator="['professorHealth']" :trigger-change="true" dictCode="health" />
        </a-form-item>
      <a-form-item label="联系方式">
        <a-input addon-before="办公室" v-decorator="['professorOfficeTel']" :disabled="isNotChangeInfo" />
      </a-form-item>
      <a-form-item label="联系方式">
        <a-input addon-before="手机" v-decorator="['professorPhone']" :disabled="isNotChangeInfo" />
      </a-form-item>
      <a-form-item :wrapperCol="{span: 19, offset: 5}">
        <a-button type="primary" style="float: left" @click="prevStep">上一页</a-button>
        <a-button type="primary" style="float: right" @click="nextStep">下一页</a-button>
      </a-form-item>
    </a-form>
  </div>
</template>

<script>
  import JDate from '@/components/jeecg/JDate'
  import JCategorySelect from '@/components/jeecg/JCategorySelect'
  import JTreeSelect from '@/components/jeecg/JTreeSelect'
  import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
  import ATextarea from "ant-design-vue/es/input/TextArea";
  import {downloadFile} from '@/api/manage'
  // 导入
  import JImageUpload from '@/components/jeecg/JImageUpload'
  import ACol from "ant-design-vue/es/grid/Col";
  export default {
    components:{
      ACol,
      ATextarea,
      JAreaLinkage,
      JTreeSelect,
      JImageUpload,
      JCategorySelect,
      JDate,
      JTreeSelect,
      downloadFile
    },
    props:{
      tes:{
        default:{},
        type: Object
      },
  isNotChangeInfo:{
    default:0,
    type: Boolean
  }
    },
    created(){
      this.proInfo = this.tes;
    },
    mounted(){
      console.log("王月鸟")
      console.log(this.tes)
      this.form.setFieldsValue({
        professorName:this.tes.professorName,
        professorSex:this.tes.professorSex,
        professorBirthday:this.tes.professorBirthday,
        professorEducationBackground:this.tes.professorEducationBackground,
        professorDegree:this.tes.professorDegree,
        professorAddress:this.tes.professorAddress,
        professorIdentity:this.tes.professorIdentity,
        professorHomeAddress:this.tes.professorHomeAddress,
        professorHealth:this.tes.professorHealth,
       professorOfficeTel:this.tes.professorOfficeTel,
       professorPhone:this.tes.professorPhone,
      });
    },
    name: "Step1",
    data(){
      return{
        labelCol: { span: 4 },
        wrapperCol: { span: 14 },
        fieldvalue:{
          professorName:'',
          professorSex:'',
          professorBirthday:'',
          professorIdentity:'',
          professorEducationBackground:'',
          professorDegree:'',
          professorAddress:'',
          professorHomeAddress:'',
          professorHealth:'',
          professorOfficeTel:'',
          professorPhone:'',
        },
        proInfo:{},
        majorId:"",
        schoolId:"",
        form:this.$form.createForm(this),
        imageUrl: '',
        model:{},
        validatorRules:{},
        url:"/sendToDing",
        downLoadUrl:'/professorInfo.xlsx',
        exportPdfUrl:"/org/exportProfessor/exportPDF",
        downloadPdfUrl:"/sys/common/static/",
      }
    },
    methods: {

      getfieldvalue(){
        const that = this;
        this.form.validateFields(() => {
          // 获取表单中type的id
          this.fieldvalue.professorName = that.form.getFieldValue("professorName");
          this.fieldvalue.professorSex = that.form.getFieldValue("professorSex");
          this.fieldvalue.professorBirthday = that.form.getFieldValue("professorBirthday");
          this.fieldvalue.professorIdentity = that.form.getFieldValue("professorIdentity");
          this.fieldvalue.professorEducationBackground = that.form.getFieldValue("professorEducationBackground");
          this.fieldvalue.professorDegree = that.form.getFieldValue("professorDegree");
          this.fieldvalue.professorAddress = that.form.getFieldValue("professorAddress");
          this.fieldvalue.professorHomeAddress = that.form.getFieldValue("professorHomeAddress");
          this.fieldvalue.professorHealth = that.form.getFieldValue("professorHealth");
          this.fieldvalue.professorOfficeTel = that.form.getFieldValue("professorOfficeTel");
          this.fieldvalue.professorPhone = that.form.getFieldValue("professorPhone");
        })
      },
      nextStep () {
        this.getfieldvalue();
        this.$emit('nextStep');
        this.$emit('setfiled',this.fieldvalue);
      },
      prevStep () {
        this.getfieldvalue();
        this.$emit('prevStep')
        this.$emit('setfiled',this.fieldvalue);
      }
    }
  }
</script>

<style>
  .ant-form-item-label{
    padding-top: 5px !important;
  }
  .ant-col-4{
    width: 25% !important;
    text-align: center !important;
  }
  .ant-col-14{
    width: 70% !important;
  }

</style>